package gs.wicket.app.account;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import gs.wicket.app.index.*;
import gs.wicket.app.base.*;
import gs.wicket.app.session.*;


public class AccountPage extends BasePage {
	public AccountPage() {

		GSSession gsSession = (GSSession) getSession();
		Korisnik k = gsSession.getLogovanKorisnik();
		if (k==null ){
			if(gsSession.getLanguage()=="ba")
				k=new Korisnik("N/A","N/A","Trenutno niste prijavljeni","N/A","N/A","N/A","N/A");
			else
				k=new Korisnik("N/A","N/A","You are not logged in","N/A","N/A","N/A","N/A");
		}
		add(new Label("korisnik", k.getIme()));
		add(new Label("ime",k.getIme()));
		add(new Label("username",k.getUsername()));
		add(new Label("ulica",k.getUlica()));
		add(new Label("grad",k.getGrad()));
		add(new Label("postanskibroj",k.getPostanskiBroj()));
		add(new Label("email",k.getEmail()));
		add(new Label("account.page.user", getLangProperty("account.page.user")));
		add(new Label("account.page.name", getLangProperty("account.page.name")));
		add(new Label("account.page.username", getLangProperty("account.page.username")));
		add(new Label("account.page.address", getLangProperty("account.page.address")));
		add(new Label("account.page.city", getLangProperty("account.page.city")));
		add(new Label("account.page.zip", getLangProperty("account.page.zip")));
		add(new Label("account.page.mail", getLangProperty("account.page.mail")));
		Link logoutLink = new Link("cancel") {
			
			private static final long serialVersionUID = 1233L;
			
			
			@Override
			public void onClick() {
				//getRequestCycle().setRedirect(false);
				getSession().invalidate();
				setResponsePage(IndexPage.class);				
			}
		};
		if(gsSession.getLogovanKorisnik()==null)
			logoutLink.add(new Label("logout"," "));		
		else
			logoutLink.add(new Label("logout","Log out"));
		
		add(logoutLink);
	}

}